{% extends 'new-layout/layout.html' %}
{% import 'libs/libs.html' as libs %}
{% import 'libs/const.html' as const %}

{% block title_nav %}
<li><a href="{{ request.cookies.get('goback_url', '/user/') }}">用户列表</a></li>
{% endblock %}

{% block body %}
<div class="row">
    <div class="col-lg-4 col-md-4 col-xs-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">基本信息</div>
            <div class="ibox-content">
                <table class="table table-bordered">
                    <tr><th>uid</th><td>{{ user.uid }}</td></tr>
                    <tr><th>手机号码</th><td>{{ user.mobile }}</td></tr>
                    <tr><th>头像</th><td><img src="{{ user.avatar_small }}" style="width:50px;"></td></tr>
                    <tr><th>妮称</th><td>{{ user.nickname }}</td></tr>
                    <tr><th>性别</th><td>{{ const.GENDER.get(user.gender, 0) }}</td></tr>
                    <tr><th>出生年</th><td>{{ user.birth_year }}</td></tr>
                    <tr><th>真实姓名</th><td>{{ user.realname }}</td></tr>
                    <tr><th>身份证号码</th><td>{{ user.id_no }}</td></tr>
                    <tr><th>地址</th><td>{{ user.province + ' ' + user.city + ' ' + user.district }}</td></tr>

                    <tr><th>注册时间</th><td>{{ user.regtime|format_timestamp }}</td></tr>
                    <tr><th>注册ip</th><td>{{ user.regip }}</td></tr>
                    <tr><th>最后访问时间</th><td>{{ user.lastvisit|format_timestamp }}</td></tr>
                    <tr><th>最后访问IP</th><td>{{ user.lastip }}</td></tr>
                    <tr><th>经度</th><td>{{ user.jingdu }}</td></tr>
                    <tr><th>纬度</th><td>{{ user.weidu }}</td></tr>

                    <tr><th>手机厂商</th><td>{{ user.vendor }}</td></tr>
                    <tr><th>手机型号</th><td>{{ user.device }}</td></tr>
                    <tr><th>os</th><td>{{ user.os }}</td></tr>
                    <tr><th>系统版本号</th><td>{{ user.osver }}</td></tr>
                    <tr><th>客户端版本号</th><td>{{ user.version }}</td></tr>

                </table>
            </div>
        </div>
    </div>

    <div class="col-lg-4 col-md-4 col-xs-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">老师信息</div>
            <div class="ibox-content">
                <form class="form-horizontal" method="POST" action="">
                    {{ libs.input('妮称', 'nickname', teacher.nickname) }}
                    {{ libs.input('真实姓名', 'realname', teacher.realname) }}
                    {{ libs.select('性别', 'gender', teacher.gender, [
                            ('请选择……', '0'), ('男', '1'), ('女', '2')]) }}
                    {{ libs.input('出生年', 'birth_year', teacher.birth_year) }}
                    {{ libs.input('身份证号码', 'id_no', teacher.id_no) }}
                    {{ libs.select('是否显示', 'is_display', teacher.is_display, [
                            ('请选择……', '-1'), ('下架不显示', '0'), ('上架显示', '1')]) }}

                    {{ libs.textarea('签名', 'signature', teacher.signature) }}
                    {{ libs.textarea('认证标签', 'cert_tags', teacher.cert_tags, help='如：专英六级 省队') }}
                    

                    <div class="form-group">
                        <div class="col-lg-4"></div>
                        <div class="col-lg-8">
                            <button type="submit" class="btn btn-primary">提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="col-lg-4 col-md-4 col-xs-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">相册</div>
            <div class="ibox-content">
                <div class="row">
                {% for ui in ui_list %}
                    <div class="file-box">
                        <div class="file">
                            <a target="_blank" href="{{ ui.img_original }}">
                                <span class="corner"></span>
                                <div class="image">
                                    <img src="{{ ui.img_thumb }}" class="img-responsive" alt="image">
                                </div>
                                <div class="file-name">
                                    <small>{{ ui.add_time|get_social_time }}</small>
                                    <br/>
                                {% if ui.is_delete == 0 %}
                                    <a href="javascript:;" onclick="delete_image(this, {{ ui.id }}, 1);">删除</a>
                                {% else %}
                                    <a href="javascript:;" onclick="delete_image(this, {{ ui.id }}, 0);">恢复</a>
                                {% endif %}
                                </div>
                            </a>
                        </div>
                    </div>
                {% endfor %}
                </div>
            </div>
        </div>
    </div>

    <div class="col-lg-4 col-md-4 col-xs-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">执教区域</div>
            <div class="ibox-content">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <td>序号</td>
                            <td>区域id</td>
                            <td>行政区</td>
                        </tr>
                    </thead>
                    <tbody>
                    {% for tr in tr_list %}
                        <tr>
                            <td>{{ loop.index }}</td>
                            <td>{{ tr.region_id }}</td>
                            <td>{{ tr.region_name }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="col-lg-6 col-md-6 col-xs-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">执教项目</div>
            <div class="ibox-content">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <td>名称</td>
                            <td>价格</td>
                            <td>授课人数</td>
                            <td>日期</td>
                            <td>时间</td>
                        </tr>
                    </thead>
                    <tbody>
                    {% for tg in tg_list %}
                        <tr>
                            <td>{{ tg.goods_name }}</td>
                            <td>￥{{ tg.goods_price }}</td>
                            <td>{{ tg.student_num }}</td>
                            <td>{{ tg.can_day }}</td>
                            <td>{{ tg.can_time }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    

</div>

{% endblock %}


{% block footer %}
<script type="text/javascript">
function delete_image(adom, id, is_delete) {
    $.get('/user/image/delete/'+id, {'is_delete':is_delete}, function(data) {
        if (data != 'ok') {
            alert(data);
            return;
        }

        var $a = $(adom);
        var $file_box = $a.parents('.file-box')[0];
        $file_box.remove();


    });
}
</script>
{% endblock %}